package com.honey.mybatis.generator.page;

import com.honey.compilation.java.AbstractJavaCompilation;
import com.honey.compilation.java.Field;
import com.honey.compilation.java.InnerEnum;
import com.honey.compilation.java.Method;
import com.honey.core.compiler.CompilationException;
import com.honey.core.dbmapping.introspect.IntrospectSchema;
import com.honey.core.dbmapping.introspect.IntrospectSchemaColumn;
import com.honey.mybatis.generator.AbstractProduceJavaCompilation;
import com.honey.mybatis.generator.MybatisPlugin;
import com.honey.mybatis.generator.condition.field.SortField;
import com.honey.mybatis.generator.page.field.BeginField;
import com.honey.mybatis.generator.page.field.DirField;
import com.honey.mybatis.generator.page.field.IntervalField;
import com.honey.mybatis.generator.page.field.PageBeginNameField;
import com.honey.mybatis.generator.page.field.PageCountField;
import com.honey.mybatis.generator.page.field.PageIntervalNameField;
import com.honey.mybatis.generator.page.field.PageTotalNameField;
import com.honey.mybatis.generator.page.field.TotalNumberField;
import com.honey.mybatis.generator.page.method.ConstructorMethod1;
import com.honey.mybatis.generator.page.method.ConstructorMethod2;
import com.honey.mybatis.generator.page.method.ConstructorMethod3;
import com.honey.mybatis.generator.page.method.DefaultConstructorMethod;
import com.honey.mybatis.generator.page.method.GetBeginMethod;
import com.honey.mybatis.generator.page.method.GetDirMethod;
import com.honey.mybatis.generator.page.method.GetIntervalMethod;
import com.honey.mybatis.generator.page.method.GetOrderByMethod;
import com.honey.mybatis.generator.page.method.GetSortMethod;
import com.honey.mybatis.generator.page.method.GetTotalNumberMethod;
import com.honey.mybatis.generator.page.method.SetBeginMethod;
import com.honey.mybatis.generator.page.method.SetIntervalMethod;
import com.honey.mybatis.generator.page.method.SetOrderByMethod;
import com.honey.mybatis.generator.page.method.SetTotalNumberMethod;

public class ProducePage extends AbstractProduceJavaCompilation {

	public ProducePage(MybatisPlugin mybatisPlugin,
			IntrospectSchema introspectSchema,
			IntrospectSchemaColumn introspectSchemaColumn) {
		super(mybatisPlugin, introspectSchema, introspectSchemaColumn);
	}

	@Override
	public AbstractJavaCompilation produceCompilation()
			throws CompilationException {
		return new PageClass(mybatisPlugin, introspectSchema, introspectSchemaColumn).createJavaCompilation(); 
	}

	@Override
	public Field[] produceFields() throws CompilationException {
		return new Field[]{
			(new PageCountField()).createField(),
			(new PageTotalNameField()).createField(),
			(new PageBeginNameField()).createField(),
			(new PageIntervalNameField()).createField(),
			(new IntervalField()).createField(),
			(new TotalNumberField()).createField(),
			(new BeginField()).createField(),
			(new SortField()).createField(),
			(new DirField()).createField(),
		};
	}

	@Override
	public Method[] produceMethods() throws CompilationException {
		return new Method[]{
			(new DefaultConstructorMethod()).createMethod(),
			(new ConstructorMethod3()).createMethod(),
			(new ConstructorMethod2()).createMethod(),
			(new ConstructorMethod1()).createMethod(),
			(new SetIntervalMethod()).createMethod(),
			(new GetIntervalMethod()).createMethod(),
			(new SetBeginMethod()).createMethod(),
			(new GetBeginMethod()).createMethod(),
			(new GetTotalNumberMethod()).createMethod(),
			(new SetTotalNumberMethod()).createMethod(),
			(new SetOrderByMethod()).createMethod(),
			(new GetSortMethod()).createMethod(),
			(new GetDirMethod()).createMethod(),
			(new GetOrderByMethod()).createMethod(),
		};
	}

	@Override
	public InnerEnum[] produceInnerEnumClass() throws CompilationException {
		return new InnerEnum[]{
			(InnerEnum)(new DirEnum()).createJavaCompilation()
		};
	}
	
	
}
